package com.doone.telmarket.infrastructure.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.doone.telmarket.domain.ibator.ServiceType;
import com.doone.telmarket.domain.ibator.ServiceTypeExample;
import com.doone.telmarket.infrastructure.dao.ServiceTypeDAO;
import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("serviceTypeDAO")
public class ServiceTypeDAOImpl extends SqlMapClientDaoSupport implements ServiceTypeDAO {

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public ServiceTypeDAOImpl() {
		super();
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public int countByExample(ServiceTypeExample example) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject(
				"TB_TELMARK_SERVICETYPE.ibatorgenerated_countByExample",
				example);
		return count;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public int deleteByExample(ServiceTypeExample example) {
		int rows = getSqlMapClientTemplate().delete(
				"TB_TELMARK_SERVICETYPE.ibatorgenerated_deleteByExample",
				example);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public int deleteByPrimaryKey(Integer serviceTypeId) {
		ServiceType key = new ServiceType();
		key.setServiceTypeId(serviceTypeId);
		int rows = getSqlMapClientTemplate().delete(
				"TB_TELMARK_SERVICETYPE.ibatorgenerated_deleteByPrimaryKey",
				key);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public Integer insert(ServiceType record) {
		Object newKey = getSqlMapClientTemplate().insert(
				"TB_TELMARK_SERVICETYPE.ibatorgenerated_insert", record);
		return (Integer) newKey;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public Integer insertSelective(ServiceType record) {
		Object newKey = getSqlMapClientTemplate().insert(
				"TB_TELMARK_SERVICETYPE.ibatorgenerated_insertSelective",
				record);
		return (Integer) newKey;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	@SuppressWarnings("unchecked")
	public List<ServiceType> selectByExample(ServiceTypeExample example) {
		List<ServiceType> list = getSqlMapClientTemplate().queryForList(
				"TB_TELMARK_SERVICETYPE.ibatorgenerated_selectByExample",
				example);
		return list;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public ServiceType selectByPrimaryKey(Integer serviceTypeId) {
		ServiceType key = new ServiceType();
		key.setServiceTypeId(serviceTypeId);
		ServiceType record = (ServiceType) getSqlMapClientTemplate()
				.queryForObject(
						"TB_TELMARK_SERVICETYPE.ibatorgenerated_selectByPrimaryKey",
						key);
		return record;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public int updateByExampleSelective(ServiceType record,
			ServiceTypeExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate()
				.update(
						"TB_TELMARK_SERVICETYPE.ibatorgenerated_updateByExampleSelective",
						parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public int updateByExample(ServiceType record, ServiceTypeExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate()
				.update(
						"TB_TELMARK_SERVICETYPE.ibatorgenerated_updateByExample",
						parms);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public int updateByPrimaryKeySelective(ServiceType record) {
		int rows = getSqlMapClientTemplate()
				.update(
						"TB_TELMARK_SERVICETYPE.ibatorgenerated_updateByPrimaryKeySelective",
						record);
		return rows;
	}

	/**
	 * This method was generated by Apache iBATIS ibator. This method corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	public int updateByPrimaryKey(ServiceType record) {
		int rows = getSqlMapClientTemplate().update(
				"TB_TELMARK_SERVICETYPE.ibatorgenerated_updateByPrimaryKey",
				record);
		return rows;
	}

	/**
	 * This class was generated by Apache iBATIS ibator. This class corresponds to the database table TB_TELMARK_SERVICETYPE
	 * @ibatorgenerated  Thu Oct 22 16:15:46 CST 2009
	 */
	private static class UpdateByExampleParms extends ServiceTypeExample {
		private Object record;

		public UpdateByExampleParms(Object record, ServiceTypeExample example) {
			super(example);
			this.record = record;
		}

		public Object getRecord() {
			return record;
		}
	}

	@Autowired
	public void setSqlMapClientBase(SqlMapClient sqlMapClient) {
		super.setSqlMapClient(sqlMapClient);
	}
}